import request from '@/utils/request'

// 获取用户列表
export function getUserList(query) {
  return request({
    url: '/api/chat/user-list',
    method: 'get',
    params: query
  })
}

// 获取聊天历史记录
export function getChatHistory(query) {
  return request({
    url: '/api/chat/history',
    method: 'get',
    params: query
  })
}

// 发送聊天消息
export function sendChatMessage(data) {
  return request({
    url: '/api/chat/message',
    method: 'post',
    data: data
  })
}

// 标记消息为已读
export function markMessageAsRead(userId) {
  return request({
    url: '/api/chat/mark-read',
    method: 'put',
    data: { userId }
  })
}

// 更新消息状态
export function updateMessageStatus(messageId, sendStatus) {
  return request({
    url: '/api/chat/update-status',
    method: 'put',
    data: { messageId, sendStatus }
  })
}

// 获取快捷回复列表
export function getQuickReplyList() {
  return request({
    url: '/api/chat/quick-reply/list',
    method: 'get'
  })
}

// 根据分类获取快捷回复
export function getQuickReplyByCategory(category) {
  return request({
    url: `/api/chat/quick-reply/category/${category}`,
    method: 'get'
  })
}

// 获取快捷回复分类
export function getQuickReplyCategories() {
  return request({
    url: '/api/chat/quick-reply/categories',
    method: 'get'
  })
}

// 添加快捷回复
export function addQuickReply(data) {
  return request({
    url: '/api/chat/quick-reply',
    method: 'post',
    data: data
  })
}

// 修改快捷回复
export function updateQuickReply(data) {
  return request({
    url: '/api/chat/quick-reply',
    method: 'put',
    data: data
  })
}

// 删除快捷回复
export function deleteQuickReply(id) {
  return request({
    url: `/api/chat/quick-reply/${id}`,
    method: 'delete'
  })
}

// 获取未读消息数量
export function getUnreadCount() {
  return request({
    url: '/api/chat/unread-count',
    method: 'get'
  })
} 